package search

import (
	"fmt"
	"strings"
	// Terminal UI
	"github.com/pterm/pterm"
)

func Search() (string) {
	// input form
	input, err := pterm.DefaultInteractiveTextInput.Show()
	if err != nil {
		panic("Graphic (first input) error!")
	}
	pterm.FgLightGreen.Printfln("Search: %s", (input))
	
	url := fmt.Sprintf("https://y.com.sb/search?q=%s", input)
	
	url = strings.ReplaceAll(url, "+", "%2B")
	return strings.ReplaceAll(url, " ", "+")
}

